import json
import os
from pathlib import Path

BASE_DIR = Path(__file__).resolve().parent.parent
CONFIG_JSON_PATH = os.path.join(BASE_DIR,'app','config.json')


class Config:
    _instance = None
    config_data = {}

    def __new__(cls, *args, **kwargs):
        if cls._instance is None:
            with open(CONFIG_JSON_PATH,'r') as f:
                config_data = json.load(f)

            cls._instance = super(Config, cls).__new__(cls)
            cls._instance.config_data = config_data

        return cls._instance


config_ins = Config()
server_config = config_ins.config_data
